﻿using Quartz;
using Quartz.Impl;
using Quartz.Spi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestQuartz
{
    class Program
    {
        static void Main(string[] args)
        {
            IScheduler sched = new StdSchedulerFactory().GetScheduler();

            //jdTest 定时任务的名字 , TestJob 继承自 IJob 接口
            JobDetailImpl jdBossReport = new JobDetailImpl("jdTest", typeof(TestJob));

            // 每天 23:45  执行一次
            IMutableTrigger triggerBossReport = CronScheduleBuilder.DailyAtHourAndMinute(10,36).Build();

            //CalendarIntervalScheduleBuilder builder = CalendarIntervalScheduleBuilder.Create();
            //builder.WithInterval(3, IntervalUnit.Second);//每 3 秒钟执行一次
            //IMutableTrigger triggerBossReport = builder.Build();

            triggerBossReport.Key = new TriggerKey("triggerTest");
            sched.ScheduleJob(jdBossReport, triggerBossReport);

            sched.Start();


        }
    }
}
